<%= form_for(@appointment) do |f| %>
  <% if @appointment.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@appointment.errors.count, "error") %> prohibited this appointment from being saved:</h2>

      <ul>
      <% @appointment.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :patient_id %><br>
    <%= collection_select(:appointment, :patient_id, Patient.all, :id, :full_name , prompt: true) %>
    <%= link_to 'New Patient', new_patient_path %>
  </div>
  <div class="field">
    <%= f.label :staff_id %><br>
    <%= collection_select(:appointment, :staff_id, Staff.all, :id, :full_name , prompt: true) %>
    <%= link_to 'New Staff', new_staff_path %>
  </div>
  <div class="field">
    <%= f.label :date_appointment %><br>
    <%= f.date_select :date_appointment %>
  </div>
  <div class="field">
    <%= f.label :time_appointment %><br>
    <%= f.time_select :time_appointment %>
  </div>
  <div class="field">
    <%= f.label :appointment_status_id %><br>
    <%= collection_select(:appointment, :appointment_status_id, AppointmentStatus.all, :id, :label , prompt: true) %>
    <%= link_to 'New Appointment Status', new_appointment_status_path %>
  </div>
  <div class="field">
    <%= f.label :registration_method_id %><br>
    <%= collection_select(:appointment, :registration_method_id, RegistrationMethod.all, :id, :label , prompt: true) %>
    <%= link_to 'New Registration Method', new_registration_method_path %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
